<!DOCTYPE html>
<html>
  <head>
	<meta charset="utf-8"> 
	<title>Bootstrap 实例</title>
	<!-- 包含头部信息用于适应不同设备 -->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- 包含 bootstrap 样式表 -->
	<link rel="stylesheet" href="css/bootstrap.min.css">
	
	<style>
	
	
	</style>
  </head>

  <body>
	  
	  <div class="container">
		  
		  <!--模态框开始-->
		  <div class="modal fade login-size" tabindex="-1" role="dialog" id="registerModal">
		    <div class="modal-dialog modal-sm" role="document">
		      <div class="modal-content">
		        <div class="modal-header">
		          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		          <h4 class="modal-title">用户注册</h4>
		        </div>
		        <div class="modal-body">
		  					
		  					<!-- 表单开始 -->
		  					<form class="form-horizontal">
		  					  <div class="form-group">
		  					    <label for="inputEmail3" class="col-sm-4 control-label">手机</label>
		  					    <div class="col-sm-8">
		  					      <input type="phone" name="phone" class="form-control" id="inputEmail3"  value="13267128038" placeholder="13267128038">
		  					    </div>
		  					  </div>
		  					  
		  					  <div class="form-group">
		  					    <label for="inputEmail3" class="col-sm-4 control-label">姓名</label>
		  					    <div class="col-sm-8">
		  					      <input type="text" name="name" class="form-control" value="海燕" id="inputEmail3" placeholder="张三">
		  					    </div>
		  					  </div>
		  					  
		  					  <div class="form-group">
		  					    <label for="inputPassword3" class="col-sm-4 control-label">密码</label>
		  					    <div class="col-sm-8">
		  					      <input type="password" name="password" class="form-control" value="123456" id="inputPassword3" placeholder="密码">
		  					    </div>
		  					  </div>
		  					</form>
		  					<!-- 表单结束-->
		        </div>
		        <div class="modal-footer">
		          <button type="button" class="btn btn-primary" id="userRegister">注册</button>
		        </div>
		      </div><!-- /.modal-content -->
		    </div><!-- /.modal-dialog -->
		  </div><!-- /.modal -->
		  <!--模态框结束-->
		  
		  
	  </div>
	  
	  
	  <script src="js/jquery-2.1.1.min.js"></script>
	  <!-- 可选: 合并了 Bootstrap JavaScript 插件 -->
	  <script src="js/bootstrap.min.js"></script>
	  
	  <script src="js/ajax.js"></script>
	  
	  <script>
		$(function(){
			//1、把模块框打开
			$('#registerModal').modal({
				'backdrop':'static',
			});
			
			//2、当用户点击注册的时候
			//2.1 提交数据到后台
			$('#userRegister').click(function(){
				
				//1 拿到所有的数据
				
				var phone=$('input[name="phone"]').val();
				var name=$('input[name="name"]').val();
				var password=$('input[name="password"]').val();
				
				var data={
					'phone':phone,
					'name':name,
					'password':password,
				}
				
				var url='http://localhost:8080/kaoqin/user/register';
				
				
				//2 发POST请求
				send(url,data,function(dataR){
					
					
					console.log(dataR);
					
					var code= dataR.code;
					if(code==200){
						window.location.href="loginT.html";
					}
				});
				
			});
			//2.2 跳转
		});
	  </script>
  </body>

</html>
